import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from '../views/LoginView.vue'
import RegisterView from '../views/RegisterView.vue'
import VideoView from '../views/VideoView.vue'
import StoreDetailView from '../views/StoreDetailView.vue'
import AddressManageView from '../views/AddressManageView.vue'
import AddressEditView from '../views/AddressEditView.vue'
import ProfileSettingsView from '../views/ProfileSettingsView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/splash'
  },
  {
    path: '/splash',
    name: 'splash',
    component: () => import(/* webpackChunkName: "splash" */ '../views/SplashView.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView
  },
  {
    path: '/register',
    name: 'register',
    component: RegisterView
  },
  {
    path: '/store/:id',
    name: 'StoreDetail',
    component: StoreDetailView
  },
  {
    path: '/video',
    name: 'video',
    component: VideoView
  },
  {
    path: '/address',
    name: 'address',
    component: AddressManageView
  },
  {
    path: '/address/edit/:id',
    name: 'addressEdit',
    component: AddressEditView
  },
  {
    path: '/address/add',
    name: 'addressAdd',
    component: AddressEditView
  },
  {
    path: '/settings',
    name: 'settings',
    component: ProfileSettingsView
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
